
const express = require('express');
const router = express.Router();
router.get('/forCurrentUser', (req, res) => {
    const data = [];
    for(let i = 1; i < 51; i++)
        data.push({
            id: `${i}`,
            code: 'string',
            dealerCode: 'string',
            dealerName: 'string',
            direction: (i % 2) + 1,
            sourceType: (i % 4) + 1,
            sourceCode: 'string',
            vin: 'string',
            productCategoryName: 'string',
            engineCode: 'string',
            transmissionSn: 'string',
            fee: 10000,
            status: 1,
            currency: 1,
            createTime: '2019-01-23T02:14:16.572Z',
            rowVersion: 'string',
            options: [
                'submit',
                'update',
                'abandon',
                'approve',
                'confirm',
                'exportDetail',
                'exportPi',
                'reportFinance',
                'confirmPi'
            ]
        });
    const {pageIndex, pageSize} = req.query;
    res.json({
        message: 'ok',
        payload: {
            content: data,
            pageIndex: parseInt(pageIndex, 10),
            pageSize: parseInt(pageSize, 10),
            totalElements: 50
        }
    });
});

router.get('/export', (req, res) => {
    res.json({
        message: '导出成功',
        payload: 'Mock导出'
    });
});

router.get('/:id', (req, res) => {
    const {id} = req.params;
    res.json({
        message: 'ok',
        payload: {
            id: `${id}`,
            brandId: 'brandId1',
            brandCode: 'brandCode',
            code: 'string',
            dealerId: '1',
            dealerCode: 'code1',
            dealerName: 'name1',
            direction: 1,
            sourceType: 1,
            sourceId: 'sourceId1',
            sourceCode: 'sourceCode',
            repairOrderCode: 'repairOrderCode',
            repairTime: '2019-06-11T02:50:03.972Z',
            reason: 'reason',
            status: 1,
            settlementStatus: 1,
            remark: 'remark',
            vin: 'vin',
            productCategoryCode: 'productCategoryCode',
            productCategoryName: 'productCategoryName',
            engineCode: 'engineCode',
            transmissionSn: 'transmissionSn',
            mileage: 1000,
            dutyUnitCode: 'dutyUnitCode',
            dutyUnitName: 'dutyUnitName',
            causePartCode: 'causePartCode',
            causePartName: 'causePartName',
            faultModeCode: 'faultModeCode',
            faultModeName: 'faultModeName',
            faultDescription: 'faultDescription',
            laborFee: 1000,
            materialFee: 2000,
            usedPartShippingFee: 3000,
            mgmtFee: 4000,
            otherClaimFee: 5000,
            outFee: 6000,
            fee: 21000,
            creatorName: 'string',
            createTime: '2019-01-23T02:16:13.657Z',
            modifierName: 'string',
            modifyTime: '2019-01-23T02:16:13.657Z',
            abandonerName: 'string',
            abandonTime: '2019-01-23T02:16:13.657Z',
            approverName: 'string',
            approveTime: '2019-06-11T02:50:03.972Z',
            approveComment: 'approveComment',
            dealResult: 'dealResult',
            rowVersion: 'string',
            options: [
                'submit',
                'update',
                'abandon',
                'approve',
                'confirm',
                'exportDetail',
                'exportPi',
                'reportFinance',
                'confirm',
                'confirmPi'
            ],
            attachments: [
                {
                    fileId: 'file01',
                    fileName: '附件1'
                }
            ],
            piAttachments: [
                {
                    fileId: 'file01',
                    fileName: '附件1'
                }
            ],
        }
    });
});

router.put('/:id/submit', (req, res) => {
    res.json({
        message: '成功'
    });
});

router.put('/:id/audit', (req, res) => {
    res.json({
        message: '成功'
    });
});

router.put('/:id/abandon', (req, res) => {
    res.json({
        message: '成功'
    });
});
router.put('/:id/pass', (req, res) => {
    res.json({
        message: '审核通过'
    });
});
router.put('/:id/reject', (req, res) => {
    res.json({
        message: '审核不通过'
    });
});
router.put('/:id/reportFinance', (req, res) => {
    res.json({
        message: '上报财务成功'
    });
});
router.put('/:id/confirm', (req, res) => {
    res.json({
        message: '确认通过'
    });
});
router.put('/:id', (req, res) => {
    res.json({
        message: '修改成功'
    });
});
router.get('/:id/export', (req, res) => {
    res.json({
        message: '导出成功'
    });
});
router.get('/:id/exportPi', (req, res) => {
    res.json({
        message: '导出PI成功'
    });
});
router.post('/', (req, res) => {
    res.json({
        message: '新增成功'
    });
});
router.put('/:id/confirmPiPass', (req, res) => {
    res.json({
        message: '确认通过'
    });
});
router.put('/:id/confirmPiReject', (req, res) => {
    res.json({
        message: '确认驳回'
    });
});
module.exports = router;
